<template>
  <div class="brand_page">
    <h3>LOOKBOOK图文编辑</h3>
    <div class="row">
      <textarea name="editor1" id="editor1" class="ckeditor" rows="10" cols="80">
        ......
      </textarea>
      <el-button type="primary" style="margin:20px 0 0 0" @click="uploadData()">提交</el-button>
    </div>
  </div>
</template>
<script>
import g from '../../components/global.js'
export default {
  mounted() {
    CKEDITOR.replace('editor1')
    this.getData()
  },
  methods: {
    uploadData() {
      var that = this
      var formtxt1 = CKEDITOR.instances.editor1.getData()
      $.ajax({
        type: 'post',
        url: g.res_url + '/api/v1/Admin_lookbook',
        data: {
          content: formtxt1
        },
        success: function(data) {
          if (data == 'success') {
            that.$message.success('操作成功!')
          } else {
            that.$message.error('操作失败!')
          }
        },
        error: function() {
          that.$message.error('网络繁忙！')
        }
      })
    },
    getData() {
      $.ajax({
        type: 'post',
        url: g.res_url + '/api/v1/lookbook_getdata',
        success: function(data) {
          setTimeout(function() {
            CKEDITOR.instances.editor1.setData(data)
          }, 1000)
        }
      })
    },
    refeshFuc() {}
  }
}
</script>
<style>
</style>

